<script setup>
import {useCounterStore} from '../stores/counter'
const head=useCounterStore()
</script>

<template>

<div class="header">
    <div class="header-center">
      <ul>
        <li><a href="#">请先登录</a></li>
        <li><a href="#">免费注册</a></li>
        <li><a href="#">我的订单</a></li>
        <li><a href="#">会员中心</a></li>
        <li><a href="#">帮助中心</a></li>
        <li><a href="#">在线客服</a></li>
        <li><span class="iconfont icon-mobile-phone"></span>手机版</li>
      </ul>
    </div>
  </div>

  <!-- 导航区 -->
  <div class="content-nav">
    <div class="content-nav-center">
      <div>
        <h1><RouterLink to="/" class="logo">小兔鲜</RouterLink></h1>
      </div>
      <div>
        <ul>
          <li v-for="(item,index) in head.header"><RouterLink :to="{
            path: '/category',
             query: {
              id:item.id,
               name: item.name
             }
           }">{{ item.name }}</RouterLink></li>
        </ul>
      </div>
      <!-- 搜索 -->
      <div class="search">
        <span class="iconfont icon-search"></span>
        <input type="text" placeholder="搜一搜" size="20">
      </div>
      <!-- 购物车 -->
      <div class="shoplogo">
        <span class="iconfont icon-cart-full" style="font-size: 30px;"></span>
        <i class="num">2</i>
      </div>
    </div>
  </div>
</template>
<style lang="scss">
.header{
    width: 100%;
    height: 52px;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #333333;
    .header-center{
      width: 1240px;
      ul{
        display: flex;
        justify-content: flex-end;
        li{
          padding: 0 15px;
          a{
            font-size: 14px;
            color: #FFFFFF;
            text-align: left;
            font-weight: 400;
          }
          &:first-child{
            a{
              color: #5EB69C;
            }
            
          }
          &:last-child{
            padding-right: 0;
            border: 0;
          }
        }
      }
    }
    
  }




  .content-nav{
    width: 100%;
    height: 132px;
    position: sticky;
    top: 0;
    z-index: 999;
    background-color: white;
    .content-nav-center{
      width: 1240px;
      height: 100%;
      margin: 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
        .logo{
          display: block;
          width: 200px;
          height: 88px;
          background-size: contain;
          font-size: 0;
          background-image: url(../assets/images/logo.png);
        }
      ul{
        display: flex;
        justify-content: center;
        align-items: center;
        margin-right: 40px;
        li{
          padding:0 23.5px;
          font-size: 16px;
          color: #333333;
          font-weight: 400;
          a:hover{
            color: #5EB69C;
            padding-bottom: 10px;
            border-bottom: 2px solid #5EB69C;
          }
        }
      }
      .search{
        width: 170px;
        height: 35px;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-right: 40px;
        border-bottom: 2px solid #F4F4F4;
        span{
          font-size: 20px;
          color: #CCCCCC;
        }
        input{
          margin-left: 8px;
          width: 150px;
          font-size: 16px;
        }
      }
      .shoplogo{
        position: relative;
        .num{
          height: 15px;
          padding: 0 5px;
          position: absolute;
          left: 15px;
          top: 0;
          background: #E26237;
          border-radius: 7px;
          text-align: center;
          line-height: 15px;
          font-size: 14px;
          color: #FFFEFE;
        }
      }
    }
  }
</style>
    